import Vue from 'vue'
// 直接将Vue组件作为Vue.extend的参数
import qrcode from './qrcode.vue'

const drawQrcode = (data, config) => {
    let callback = data.callback || null;
    const drawQrcodeConstructor = Vue.extend(qrcode);
    const instance = new drawQrcodeConstructor({
        el: document.createElement('div')
    });
    document.querySelector("body").appendChild(instance.$el);
    return instance.show(callback, config);
}

export default drawQrcode;